package com.bg.sparkproject.pattern.proxy.statics;

import com.bg.sparkproject.pattern.proxy.BuyHosue;

/**
 * @Auther: zhengshunzhi
 * @Date: 2019/1/4 11:40
 * @Description: 静态代理类
 */
public class BuyHouseProxy implements BuyHosue {

    private BuyHosue buyHouse;

    public BuyHouseProxy(final BuyHosue buyHouse) {
        this.buyHouse = buyHouse;
    }

    @Override
    public void buyHosue() {
        System.out.println("买房前准备");
        buyHouse.buyHosue();
        System.out.println("买房后装修");
    }

    public static void main(String[] args) {
        BuyHosue buyHouse = new BuyHosueImpl();
        buyHouse.buyHosue();

        System.out.println("--------------------------------------------");

        BuyHosue buyHouseProxy = new BuyHouseProxy(buyHouse);
        buyHouseProxy.buyHosue();
    }
}
